//
//  ViewController.m
//  cocoapodText
//
//  Created by apple on 16/8/5.
//  Copyright © 2016年 apple. All rights reserved.
//
#import "ShiPei.h"
//导入时需要手动打上，系统没有提示
#import "Charts-Swift.h"
#import "MainViewController.h"
#import "PieChartViewController.h"
#import "BarChartViewController.h"
#import "LineChartViewController.h"
#import "RadarChartViewController.h"
#import "LineChartViewController2.h"
#import "BubbleChartViewController.h"
#import "ScatterChartViewController.h"
#import "SinusBarChartViewController.h"
#import "CombinedChartViewController.h"
#import "CubicLineChartViewController.h"
#import "AnotherBarChartViewController.h"
#import "StackedBarChartViewController.h"
#import "PiePolylineChartViewController.h"
#import "CandleStickChartViewController.h"
#import "ColoredLineChartViewController.h"
#import "MultipleBarChartViewController.h"
#import "MultipleLinesChartViewController.h"
#import "HorizontalBarChartViewController.h"
#import "NegativeStackedBarChartViewController.h"
#import "PositiveNegativeBarChartViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initView];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}

-(void)initView{
    //可滑动底部View
    UIScrollView *MainViewAllBackScroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
    // 隐藏水平滚动条
    [MainViewAllBackScroll setShowsVerticalScrollIndicator:NO];
    [MainViewAllBackScroll setShowsHorizontalScrollIndicator:NO];
    // 去掉弹簧效果
    [MainViewAllBackScroll setBounces:NO];
    // 可点击
    [MainViewAllBackScroll setUserInteractionEnabled:YES];
    [MainViewAllBackScroll setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:MainViewAllBackScroll];
    
    UIImageView *tem_line=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 10)];
    [tem_line setBackgroundColor:[UIColor blackColor]];
    [MainViewAllBackScroll addSubview:tem_line];
    
    UIImageView *tem_line_1=[[UIImageView alloc]initWithFrame:CGRectMake(0, 694, kScreenW, 10)];
    [tem_line_1 setBackgroundColor:[UIColor blackColor]];
    [MainViewAllBackScroll addSubview:tem_line];
    [MainViewAllBackScroll addSubview:tem_line_1];
    //饼状图1
    UIButton *pieChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40, [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [pieChartButton setTitle:@"饼状图" forState:UIControlStateNormal];
    [pieChartButton setBackgroundColor:[UIColor brownColor]];
    [pieChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [pieChartButton addTarget:self
                       action:@selector(pieChartShow)
             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:pieChartButton];
    
    //饼状图2
    UIButton *piePolylineChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40, [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [piePolylineChartButton setTitle:@"饼状图2" forState:UIControlStateNormal];
    [piePolylineChartButton setBackgroundColor:[UIColor brownColor]];
    [piePolylineChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [piePolylineChartButton addTarget:self
                       action:@selector(piePolylineChartShow)
             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:piePolylineChartButton];
    
    //柱状图1
    UIButton *barChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:80], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [barChartButton setTitle:@"柱状图1" forState:UIControlStateNormal];
    [barChartButton setBackgroundColor:[UIColor brownColor]];
    [barChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [barChartButton addTarget:self
                       action:@selector(barChartShow)
             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:barChartButton];
    
    //多组对比柱状图2
    UIButton *multipleBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:80], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [multipleBarChartButton setTitle:@"多组柱状图2" forState:UIControlStateNormal];
    [multipleBarChartButton setBackgroundColor:[UIColor brownColor]];
    [multipleBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [multipleBarChartButton addTarget:self
                       action:@selector(multipleBarChartShow)
             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:multipleBarChartButton];
    
    //柱状图3
    UIButton *SinusBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:400], 40+[ShiPei CGFloatMakeScale:80], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [SinusBarChartButton setTitle:@"柱状图3" forState:UIControlStateNormal];
    [SinusBarChartButton setBackgroundColor:[UIColor brownColor]];
    [SinusBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [SinusBarChartButton addTarget:self
                                       action:@selector(SinusBarChartShow)
                             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:SinusBarChartButton];
    
    //柱状图4
    UIButton *StackedBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:600], 40+[ShiPei CGFloatMakeScale:80], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [StackedBarChartButton setTitle:@"柱状图4" forState:UIControlStateNormal];
    [StackedBarChartButton setBackgroundColor:[UIColor brownColor]];
    [StackedBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [StackedBarChartButton addTarget:self
                           action:@selector(StackedBarChartShow)
                 forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:StackedBarChartButton];
    
    //水平柱状图1
    UIButton *horizontalBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:160], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [horizontalBarChartButton setTitle:@"水平柱状图1" forState:UIControlStateNormal];
    [horizontalBarChartButton setBackgroundColor:[UIColor brownColor]];
    [horizontalBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [horizontalBarChartButton addTarget:self
                       action:@selector(horizontalBarChartShow)
             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:horizontalBarChartButton];
    
    //柱状图2
    UIButton *negativeStackedBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:160], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [negativeStackedBarChartButton setTitle:@"多水平柱状图2" forState:UIControlStateNormal];
    [negativeStackedBarChartButton setBackgroundColor:[UIColor brownColor]];
    [negativeStackedBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [negativeStackedBarChartButton addTarget:self
                                 action:@selector(negativeStackedBarChartShow)
                       forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:negativeStackedBarChartButton];
    
    //柱状图3
    UIButton *positiveNegativeBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:400], 40+[ShiPei CGFloatMakeScale:160], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [positiveNegativeBarChartButton setTitle:@"多水平柱状图3" forState:UIControlStateNormal];
    [positiveNegativeBarChartButton setBackgroundColor:[UIColor brownColor]];
    [positiveNegativeBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [positiveNegativeBarChartButton addTarget:self
                                       action:@selector(positiveNegativeBarChartShow)
                             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:positiveNegativeBarChartButton];
    //柱状图4
    UIButton *AnotherBarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:600], 40+[ShiPei CGFloatMakeScale:160], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [AnotherBarChartButton setTitle:@"柱状图4" forState:UIControlStateNormal];
    [AnotherBarChartButton setBackgroundColor:[UIColor brownColor]];
    [AnotherBarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [AnotherBarChartButton addTarget:self
                                       action:@selector(AnotherBarChartShow)
                             forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:AnotherBarChartButton];
    
    //线性图1
    UIButton *LineChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:240], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [LineChartButton setTitle:@"渐变填充线性图" forState:UIControlStateNormal];
    [LineChartButton setBackgroundColor:[UIColor brownColor]];
    [LineChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [LineChartButton addTarget:self
                        action:@selector(lineChartShow)
              forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:LineChartButton];
    
    //多组线性图
    UIButton *multipleLinesChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:240], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [multipleLinesChartButton setTitle:@"多组线性图" forState:UIControlStateNormal];
    [multipleLinesChartButton setBackgroundColor:[UIColor brownColor]];
    [multipleLinesChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [multipleLinesChartButton addTarget:self
                        action:@selector(multipleLinesChartShow)
              forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:multipleLinesChartButton];
    
    //平滑曲线
    UIButton *CubicLineChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:400], 40+[ShiPei CGFloatMakeScale:240], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [CubicLineChartButton setTitle:@"平滑曲线" forState:UIControlStateNormal];
    [CubicLineChartButton setBackgroundColor:[UIColor brownColor]];
    [CubicLineChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [CubicLineChartButton addTarget:self
                                 action:@selector(CubicLineChartShow)
                       forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:CubicLineChartButton];
    
    //线性图2
    UIButton *LineChart2Button=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:320], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [LineChart2Button setTitle:@"线性图2" forState:UIControlStateNormal];
    [LineChart2Button setBackgroundColor:[UIColor brownColor]];
    [LineChart2Button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [LineChart2Button addTarget:self
                                 action:@selector(lineChart2Show)
                       forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:LineChart2Button];
    
    //多彩线性
    UIButton *ColoredLineChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:320], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [ColoredLineChartButton setTitle:@"多彩线性" forState:UIControlStateNormal];
    [ColoredLineChartButton setBackgroundColor:[UIColor brownColor]];
    [ColoredLineChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [ColoredLineChartButton addTarget:self
                         action:@selector(ColoredLineChart2Show)
               forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:ColoredLineChartButton];
    
    //雷达图
    UIButton *RadarChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:400], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [RadarChartButton setTitle:@"雷达图" forState:UIControlStateNormal];
    [RadarChartButton setBackgroundColor:[UIColor brownColor]];
    [RadarChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [RadarChartButton addTarget:self
                         action:@selector(radarChartShow)
               forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:RadarChartButton];
    
    //蜡烛图
    UIButton *CandleStickChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:400], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [CandleStickChartButton setTitle:@"烛柱图" forState:UIControlStateNormal];
    [CandleStickChartButton setBackgroundColor:[UIColor brownColor]];
    [CandleStickChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [CandleStickChartButton addTarget:self
                         action:@selector(CandleStickChartShow)
               forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:CandleStickChartButton];
    
    //散点图
    UIButton *ScatterChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:480], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [ScatterChartButton setTitle:@"散点图" forState:UIControlStateNormal];
    [ScatterChartButton setBackgroundColor:[UIColor brownColor]];
    [ScatterChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [ScatterChartButton addTarget:self
                         action:@selector(scatterChartShow)
               forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:ScatterChartButton];
    //组合图
    UIButton *CombinedChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40+[ShiPei CGFloatMakeScale:200], 40+[ShiPei CGFloatMakeScale:480], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [CombinedChartButton setTitle:@"组合图" forState:UIControlStateNormal];
    [CombinedChartButton setBackgroundColor:[UIColor brownColor]];
    [CombinedChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [CombinedChartButton addTarget:self
                           action:@selector(CombinedChartShow)
                 forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:CombinedChartButton];
    //气泡图
    UIButton *BubbleChartButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 40+[ShiPei CGFloatMakeScale:560], [ShiPei CGFloatMakeScale:150], [ShiPei CGFloatMakeScale:60])];
    [BubbleChartButton setTitle:@"气泡图" forState:UIControlStateNormal];
    [BubbleChartButton setBackgroundColor:[UIColor brownColor]];
    [BubbleChartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [BubbleChartButton addTarget:self
                           action:@selector(BubbleChartShow)
                 forControlEvents:UIControlEventTouchUpInside
     ];
    [MainViewAllBackScroll addSubview:BubbleChartButton];
}

-(void)AnotherBarChartShow{
    AnotherBarChartViewController *Chart=[[AnotherBarChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)CubicLineChartShow{
    CubicLineChartViewController *Chart=[[CubicLineChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)CombinedChartShow{
    CombinedChartViewController *Chart=[[CombinedChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)ColoredLineChart2Show{
    ColoredLineChartViewController *Chart=[[ColoredLineChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)CandleStickChartShow{
    CandleStickChartViewController *Chart=[[CandleStickChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)BubbleChartShow{
    BubbleChartViewController *Chart=[[BubbleChartViewController alloc]init];
    [self.navigationController pushViewController:Chart animated:NO];
}

-(void)pieChartShow{
    PieChartViewController *pie=[[PieChartViewController alloc]init];
    [self.navigationController pushViewController:pie animated:NO];
}

-(void)piePolylineChartShow{
    PiePolylineChartViewController *pie=[[PiePolylineChartViewController alloc]init];
    [self.navigationController pushViewController:pie animated:NO];
}

-(void)barChartShow{
    BarChartViewController *bar=[[BarChartViewController alloc]init];
    [self.navigationController pushViewController:bar animated:NO];
}

-(void)multipleBarChartShow{
    MultipleBarChartViewController *bar=[[MultipleBarChartViewController alloc]init];
    [self.navigationController pushViewController:bar animated:NO];
}

-(void)SinusBarChartShow{
    SinusBarChartViewController *bar=[[SinusBarChartViewController alloc]init];
    [self.navigationController pushViewController:bar animated:NO];
}

-(void)StackedBarChartShow{
    StackedBarChartViewController *bar=[[StackedBarChartViewController alloc]init];
    [self.navigationController pushViewController:bar animated:NO];
}

-(void)positiveNegativeBarChartShow{
    PositiveNegativeBarChartViewController *bar=[[PositiveNegativeBarChartViewController alloc]init];
    [self.navigationController pushViewController:bar animated:NO];
}
-(void)horizontalBarChartShow{
    HorizontalBarChartViewController *horizontalBar=[[HorizontalBarChartViewController alloc]init];
    [self.navigationController pushViewController:horizontalBar animated:NO];
}

-(void)negativeStackedBarChartShow{
    NegativeStackedBarChartViewController *horizontalBar=[[NegativeStackedBarChartViewController alloc]init];
    [self.navigationController pushViewController:horizontalBar animated:NO];
}

-(void)lineChartShow{
    LineChartViewController *line1=[[LineChartViewController alloc]init];
    [self.navigationController pushViewController:line1 animated:NO];
}

-(void)multipleLinesChartShow{
    MultipleLinesChartViewController *lines=[[MultipleLinesChartViewController alloc]init];
    [self.navigationController pushViewController:lines animated:NO];
}
-(void)lineChart2Show{
    
    LineChartViewController2 *line2=[[LineChartViewController2 alloc]init];
    [self.navigationController pushViewController:line2 animated:NO];
}

-(void)radarChartShow{
    RadarChartViewController *radar=[[RadarChartViewController alloc]init];
    [self.navigationController pushViewController:radar animated:NO];
}

-(void)scatterChartShow{
    ScatterChartViewController *scatter=[[ScatterChartViewController alloc]init];
    [self.navigationController pushViewController:scatter animated:NO];
}
@end
